home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Snippets / QuickDraw / Imageer 1.0.0d3 / source / Imageer.app.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-16  |  8.4 KB  |  399 lines  |  [TEXT/MPS ]

  1. /****************************************************/
  2. /*                                                    */
  3. /*    File:        Imageer.app.h                        */
  4. /*                                                    */
  5. /*    Program:    Imageer                                */
  6. /*                                                    */
  7. /*    By:            Jason Hodges-Harris                    */
  8. /*                                                    */
  9. /*    Created:    26/10/95  00:00:00 AM                */
  10. /*                                                    */
  11. /*    Version:    1.0.0d3                                */
  12. /*                                                    */
  13. /*    Copyright:    © 1995-96 Apple Computer, Inc.,        */ 
  14. /*                    all rights reserved.            */        
  15. /*                                                    */
  16. /****************************************************/
  17.  
  18. #ifndef __IMAGEERAPPHEADER__
  19. #define __IMAGEERAPPHEADER__
  20.  
  21.  
  22. /**** Macintosh Toolbox Headers *****/
  23.  
  24. #ifndef __GXTYPES__
  25. #include <GXTypes.h>
  26. #endif
  27.  
  28. #ifndef __PALETTES__
  29. #include <Palettes.h>
  30. #endif
  31.  
  32. #ifndef __QDOFFSCREEN__
  33. #include <QDOffscreen.h>
  34. #endif
  35.  
  36. #ifndef __STANDARDFILE__
  37. #include <StandardFile.h>
  38. #endif
  39.  
  40. #ifndef __TYPES__
  41. #include <Types.h>
  42. #endif
  43.  
  44.  
  45. // Application document structure
  46.  
  47.  
  48. #if GENERATINGPOWERPC
  49. #pragma options align=mac68k
  50. #endif
  51.  
  52. struct ImageDoc
  53. {
  54.     PaletteHandle        theColorsPalette;        // used by colors window
  55.     GWorldPtr            theImageWorld;
  56.     long                theFileRefNum,
  57.                         theFileType,
  58.                         theImageXSize,
  59.                         theImageYSize;
  60.     ControlHandle        theVScrollBar,
  61.                         theHScrollBar;
  62.     gxViewPort            theGXview,
  63.                         theGxChildView;
  64.     gxShape                theGXImageShape;
  65.     gxInk                theInkShape;
  66.     gxTransferMode        theUndoInkTransform;
  67.     gxTransform            theUndoShapeTransform;
  68.     StandardFileReply    theImageFileReply;
  69.     FSSpec                theTempUndoFileSpec,
  70.                         theTempRedoFileSpec;
  71.     Rect                theMaxWindowSize;
  72.     short                theImageDepth,
  73.                         theMenuItem,
  74.                         theLastAction,            // type of last image action
  75.                         theUndoState,            // temp file created to reverse last action
  76.                         theGXUndoType;
  77.     Boolean                theImageChanged,
  78.                         isUsingQDGX,            // set dependent on image model used
  79.                         isColorsWindow,            // used to test for colors window
  80.                         hasUndoTemp,
  81.                         hasRedoTemp;
  82. };
  83. typedef struct ImageDoc ImageDoc, *ImageDocPtr, **ImageDocHndl;
  84.  
  85.  
  86. struct TiffInfo
  87. {
  88.     short        byteOrder;                    // Intel or Motorola format
  89.     short        version;                    // Image version
  90.     long        offsetToIFD;                // offset to 1st image file directory
  91.  
  92.     long        xImageSize;                    // x coord image size
  93.     long        yImageSize;                    // y coord image size
  94.     short        PhotoInterpret;                // Photometric Interpretation
  95.     long        imageOffset;                // offset to image strip
  96.     long        rowStrip;                    // number of rows per image strip
  97.     CTabHandle    tiffCTabHndl;                // Tiff image Palette colors
  98.     short        bitDepth;                    // image bit depth
  99.     short        compressionType;            // compression
  100.     short        PlanarConfig;                // pixel storage method
  101. };
  102. typedef struct TiffInfo TiffInfo, *TiffInfoPtr;
  103.  
  104. struct UserGXSpool
  105. {
  106.     gxSpoolBlock    spool;
  107.     short            reference;
  108. };
  109. typedef struct UserGXSpool UserGXSpool;
  110.  
  111.  
  112. #if GENERATINGPOWERPC
  113. #pragma options align=reset
  114. #endif
  115.  
  116.  
  117. /****    type of image manipulation    ****/
  118.  
  119. enum
  120. {
  121.     kPixMapOp        = 1,
  122.     kColorTableOp,
  123.     kGXTransformOp
  124. };
  125.  
  126.  
  127. /****    Aplication creator    ****/
  128.  
  129. #define        AppCreator            'Im#¢'
  130.  
  131. /**** Supported image file types list    ****/
  132.  
  133. enum
  134. {
  135.     TiffType    = 1,
  136.     PictType,
  137.     GXType
  138. };
  139.  
  140.  
  141. /**** TIFF image byte formats    ****/
  142.  
  143. enum
  144. {
  145.     MotoFormat    = 'MM',
  146.     IntlFormat    = 'II'
  147. };
  148.  
  149.  
  150. /****    Image undo state    ****/
  151.  
  152. enum
  153. {
  154.     kCannotUndo = 1,
  155.     kCanUndo,
  156.     kCanRedo
  157. };
  158.  
  159.  
  160. /**** Menubar constant definitions ****/
  161.  
  162. #define        rMenuBar            128
  163.  
  164. #define     mApple                128
  165. #define     iAbout                1
  166.  
  167. #define        mFile                129
  168. #define        iOpen                1
  169. #define     iClose                2
  170. #define        iCloseAll            3
  171. #define     iSave                5
  172. #define        iSaveAs                6
  173. #define        iRevert                7
  174. #define     iQuit                9
  175.  
  176. #define        mEdit                130
  177. #define     iUndo                1
  178. #define     iCut                3
  179. #define        iCopy                4
  180. #define     iPaste                5
  181.  
  182. #define        mWindow                131
  183. #define        iColors                1
  184.  
  185. #define        mFilters            132
  186. #define        iSmoothFilter        1
  187. #define        iHiPassFilter        2
  188.  
  189. #define        mEffects            133
  190. #define        iInvert                1
  191. #define        iBrighness            3
  192. #define        iContrast            4
  193. #define        iColorComp            6
  194. #define        iMirrorXaxis        8
  195. #define        iMirrorYaxis        9
  196. #define        iRotate180            10
  197.  
  198. #define        mBrightness            134
  199. #define        iLighter            1
  200. #define        iDarker                2
  201.  
  202. #define        mContrast            135
  203. #define        iIncrease            1
  204. #define        iDecrease            2
  205.  
  206. #define        mColor                136
  207. #define        iRedColorComp        1
  208. #define        iGreenColorComp        2
  209. #define        iBlueColorComp        3
  210.  
  211. #define     mModel                137
  212. #define        iUseQDGX            1
  213.  
  214. #define        mFileType            138
  215. #define        iTiffType            1
  216. #define        iPictType            2
  217. #define        iGXType                3
  218. #define        iAllFiles            4
  219.  
  220. #define        mSaveFileType        139
  221. #define        iSaveTiffType        1
  222. #define        iSavePictType        2
  223. #define        iSaveGXType            3
  224.  
  225.  
  226. /**** General Application Constant definitions ****/
  227.  
  228. #define        kSleep                3L        // Used in wait next event
  229. #define        kLoadFilePopUpItem    10
  230. #define        kSaveFilePopUpItem    13
  231. #define        kProgressSteps        200
  232. #define        kNull_Str            ""
  233. #define        kOkButton            1
  234. #define        kSplashScrDelay        90        // 1.5 secs delay
  235. #define        rSplashPICT            128
  236. #define        kRadioButton        6
  237. #define        kSpoolBlockSize        1024
  238. #define        kLargeScroller        32
  239. #define        kSmallScroller        8
  240. #define        kMinLowMem            0x2800
  241. #define        kScrollBarWidth        15
  242.  
  243. /****    Window and dialog resource IDs    ****/
  244.  
  245. #define        rGenWindow            128
  246. #define        rColorsWindow        129
  247. #define        rAboutBox            128
  248. #define        rGenAlert            129
  249. #define        rGenWarning            130
  250. #define        rCustomOpenDialog    131
  251. #define        rCustomSaveDialog    132
  252. #define        rProgressBarWindow    130
  253. #define        rSplashWindow        131
  254. #define        rPictCompDialog        133
  255.  
  256.  
  257. /****    File System definitions    ****/
  258.  
  259. #define        kFolderBit            0x10
  260. #define        kFileVisibleBit        0x004000
  261.  
  262.  
  263. /****    STR# resource items    ****/
  264.  
  265. #define        rErrMessages        128
  266. #define        iNotImplemented        1
  267. #define        iLowTempMem            2
  268. #define        iFailAllocMem        3
  269. #define        iNoSupportBitDepth    4
  270.  
  271. #define        rQDGXmessages        129
  272. #define        iGXNotInstalled        1
  273. #define        iGXLibNotLoaded        2
  274. #define        iGXLoadErr            3
  275. #define        iCannotSwitchGX        4
  276. #define        iCannotConvToGX        5
  277. #define        iTransformFailed    6
  278. #define        iInkGetFail            7
  279. #define        iFailInitPrint        8
  280.  
  281. #define        rQDMessages            130
  282. #define        iFailGWorldAlloc    1
  283. #define        iFailLockPixmap        2
  284.  
  285. #define        rMenuItems            131
  286. #define        iShowColors            1
  287. #define        iHideColors            2
  288. #define        iOpUndo                3
  289. #define        iOpCantUndo            4
  290. #define        iOpRedo                5
  291.  
  292. #define        rImageModel            132
  293. #define        iUseColorQD            1
  294. #define        iUseQuickDrawGX        2
  295.  
  296. #define        rProgressMessages    133
  297. #define        iLoading            1
  298. #define        iSaving                2
  299.  
  300. #define        rFileIOMessages        134
  301. #define        iSaveCompPICTErr    1
  302. #define        iSaveUnCompPICTErr    2
  303. #define        iSaveQDGXErr        3
  304. #define        iCreateTempFldrErr    4
  305. #define        iCreateTempFileErr    5
  306. #define        iDeleteTempFileErr    6
  307. #define        iDiskFullErr        7
  308. #define        iRevertFileFail        8
  309. #define     iTiffNotSupported    9
  310.  
  311.  
  312. /****    application defined    error values    ****/
  313.  
  314. #define        kDefaultAppError    1000    // application return error
  315. #define        kFailedLockPixels    1001    // application failed to lock down GWorld PixMap
  316. #define        kFileLoadAbortErr    1002    // failed to load image or cancel selected
  317. #define        kFailMakePalette    1003    // failed to create a new palette
  318. #define        kLowMemWarning        1004    // Low temporary memory warning
  319. #define        kFailGetPixMap        1005    // Failed to retrieve PixMap handle from window doc structure
  320. #define        kFailImageComp        1006    // Failed to compress image.
  321. #define        kPtrNotCreated        1007    // Failed to create memory allocation for pointer
  322. #define        kNotSupported        1008    // Function not supported
  323. #define        kGXFileLoadErr        1009    // Failed to load in GX based image file
  324. #define        kQDtoGXConvErr        1010    // Failed to convert from color QuickDRaw to QDGX
  325. #define        kFailAllocDocHndl    1011    // Failed to allocate handle for window Doc structure
  326. #define        kBitDepthErr        1012    // Image Bit Depth not supported for operation
  327. #define        kGXFailTransform    1013    // QDGX transform operation failed
  328. #define        kGXFailGetInk        1014    // QDGX fail to get ink object
  329. #define        kFailMakeGWorld        1015    // Failed to allocate memory for image GWorld 
  330. #define        kFailPictCompSave    1016    // Save compressed PICT file failure
  331. #define        kFailPictUnCompSave    1017    // Save uncompressed PICT file failure
  332. #define        kFailQDGXSave        1018    // Save QDGX file failure
  333. #define        kTIFFNotSupported    1019    // TIFF File contains tags not currently parsed
  334.  
  335.  
  336. /****    Control resource values    ****/
  337.  
  338. #define        rVScrollBar            128
  339. #define        rHScrollBar            129
  340. #define        rProgressCntl        130
  341.  
  342.  
  343. /****    PICT compression dialog radion button IDs    ****/
  344.  
  345. enum
  346. {
  347.     kNoCompression = 2,
  348.     kHighQuality,
  349.     kMediumQuality,
  350.     kLowQuality
  351. };
  352.     
  353.     
  354. /****    image model return error codes    ****/
  355.  
  356. enum
  357. {
  358.     kCannotConvertToGX = 1,
  359.     kCannotConvertToQD
  360. };
  361.  
  362.  
  363. /**** GWorld flags ****/
  364.  
  365. enum
  366. {
  367.     kNoFlags = 0
  368. };
  369.  
  370. /****    Color components    ****/
  371.  
  372. enum
  373. {
  374.     kRedComp    = 1,
  375.     kGreenComp,
  376.     kBlueComp
  377. };
  378.  
  379.  
  380. /****    QuickDraw GX transform types. Used for Undo operation    ****/
  381.  
  382. enum
  383. {
  384.     kGXinkTransform = 1,
  385.     kGXshapeTransform
  386. };
  387.  
  388.  
  389. /****    Progress Bar display options    ****/
  390.  
  391. enum
  392. {
  393.     kDisplayProgressWindow,
  394.     kUpdateProgressWindow,
  395.     kDisposeProgressWindow
  396. };
  397.  
  398.  
  399. #endif // __IMAGEERAPPHEADER__